package com.qfedu.edu.iotserver.controller;


import com.qfedu.edu.iotserver.service.ProductService;
import com.qfedu.edu.pojo.Product;
import com.qfedu.edu.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 产品表 前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2024-09-13
 */
@RestController
@RequestMapping("/iotserver/product")
@Api(description = "产品模块", tags = "产品模块")
public class ProductController {

    @Autowired
    private ProductService productService;


    /**
     * 添加产品
     *
     * @param product
     * @return
     */
    @PostMapping("addProduct")
    @ApiOperation("产品添加接口")
    @ApiImplicitParam(name = "token", value = "用户令牌", required = true, dataType = "string", paramType = "header")
    public R addProduct(@RequestBody Product product, HttpServletRequest req) {
        productService.add(product,req);
        return R.ok();
    }


}

